// sub_process.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
	for (int i = 0; i < argc; ++i)
	{
		printf(argv[i]);
		Sleep(2000);
	}

	const int MM_VIEW_SIZE = 100;

	HANDLE hFileMap = (HANDLE)atoi(argv[0]);
	printf("%d", hFileMap);
	char* pvFile = (char*)MapViewOfFile(hFileMap, FILE_MAP_WRITE, 0, 0, MM_VIEW_SIZE);
	CloseHandle(hFileMap);

	do 
	{
		pvFile[MM_VIEW_SIZE - 1] = 0;
		printf("%s\n", pvFile);
		Sleep(2000);
	} 
	while (true);

	UnmapViewOfFile(pvFile);

	return 0;
}

